<template>
  <div class="app-container">
    <el-row>
      <el-col :span="24">
        <div class="h_top">
          <div class="bread_title">
            <span>新增设备处置</span>
          </div>
          <div class="add_button">
            <div class="buttonBox">
              <el-button type="primary" icon="el-icon-document-checked" size="mini" @click="save">保存</el-button>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <div>
      <el-row>
        <el-col :span="24">
          <el-form ref="form" :model="data" :inline="true" :rules="formRules">
            <el-row :gutter="10">
              <el-col :span="4">
                <el-form-item prop="coding">
                  <div>编号</div>
                  <el-input v-model="data.coding" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="name">
                  <div>名称</div>
                  <el-input v-model="data.name" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="equipment_id">
                  <div>资产</div>
                  <v-select v-model="data.equipment_id" action="eqList" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="usedYear">
                  <div>使用年限</div>
                  <el-input v-model="data.usedYear" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="department_id">
                  <div>申请部门</div>
                  <v-select v-model="data.department_id" action="departmentList" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="date">
                  <div>申请日期</div>
                  <el-date-picker v-model="data.date" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="status">
                  <div>状态</div>
                  <el-select v-model="data.status" size="mini" disabled>
                    <el-option v-for="(item, index) in turnStatus" :key="index" :value="index" :label="item" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="old_value">
                  <div>原值</div>
                  <el-input v-model="data.old_value" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="depreciation">
                  <div>累计折旧</div>
                  <el-input v-model="data.depreciation" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="new_value">
                  <div>净值</div>
                  <el-input v-model="data.new_value" size="mini" />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item prop="sort">
                  <div>排序</div>
                  <el-input v-model="data.sort" size="mini" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
          <el-tabs>
            <el-tab-pane label="使用部门">
              <el-row :gutter="10">
                <el-col :span="4">
                  <div>
                    <span>经办人</span>
                    <v-select v-model="data.shiyong_admin_id" class="mtb10" />
                  </div>
                </el-col>
                <el-col :span="20">
                  <div class="mtb10">处置原因 （评定依据）</div>
                  <wangeditor id="cshiyong" v-model="data.cshiyong" />
                  <div class="mtb10">部门负责人意见</div>
                  <wangeditor id="bshiyong" v-model="data.bshiyong" />
                  <div class="mtb10">主管领导意见</div>
                  <wangeditor id="zshiyong" v-model="data.zshiyong" />
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="归口管理部门">
              <el-row :gutter="10">
                <el-col :span="4">
                  <div>
                    <span>鉴定人</span>
                    <v-select v-model="data.guikou_uesd_id" class="mtb10" />
                  </div>
                  <div>
                    <span>部门负责人</span>
                    <v-select v-model="data.guikou_admin_id" class="mtb10" />
                  </div>
                </el-col>
                <el-col :span="20">
                  <div class="mtb10">技术鉴定及处置意见（鉴定结果、处置方案）</div>
                  <wangeditor id="jguikou" v-model="data.jguikou" />
                  <div class="mtb10">主管领导意见</div>
                  <wangeditor id="zguikou" v-model="data.zguikou" />
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="资产管理部门">
              <el-row :gutter="10">
                <el-col :span="4">
                  <div>
                    <span>经办人</span>
                    <v-select v-model="data.zichan_ueed_id" class="mtb10" />
                  </div>
                  <div>
                    <span>部门负责人</span>
                    <v-select v-model="data.zichan_admin_id" class="mtb10" />
                  </div>
                </el-col>
                <el-col :span="20">
                  <div class="mtb10">主管领导意见</div>
                  <wangeditor id="zzichan" v-model="data.zzichan" />
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="财务部">
              <el-row :gutter="10">
                <el-col :span="4">
                  <div>
                    <span>资产会计</span>
                    <v-select v-model="data.caiwu_ues_id" class="mtb10" />
                  </div>
                  <div>
                    <span>部门负责人</span>
                    <v-select v-model="data.caiwu_admin_id" class="mtb10" />
                  </div>
                </el-col>
                <el-col :span="20">
                  <div class="mtb10">主管领导意见</div>
                  <wangeditor id="zcaiwu" v-model="data.zcaiwu" />
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="描述">
              <el-row :gutter="10">
                <el-col :span="24">
                  <wangeditor id="content" v-model="data.content" />
                </el-col>
              </el-row>
            </el-tab-pane>
          </el-tabs>
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import API from '@/api/asset/management'
import { typeCategory, turnStatus } from '@/utils/options'
import Wangeditor from '@/components/editor/wangeditor'
import VSelect from '@/components/select'
export default {
  inject: ['addOne'],
  components: {
    Wangeditor,
    VSelect
  },
  data() {
    return {
      data: {
        coding: '',
        name: '',
        turn: '1',
        date: '',
        status: 0,
        old_value: '',
        depreciation: '',
        new_value: '',
        type: '',
        sort: '100'
      },
      typeCategory,
      turnStatus,
      formRules: {
        coding: [
          {
            required: true,
            message: '请输入编号',
            trigger: 'blur'
          }
        ],
        name: [
          {
            required: true,
            message: '请输入名称',
            trigger: 'blur'
          }
        ],
        equipment_id: [
          {
            required: true,
            message: '请选择资产',
            trigger: 'change'
          }
        ],
        usedYear: [
          {
            required: true,
            message: '请输入使用年限',
            trigger: 'blur'
          }
        ],
        department_id: [
          {
            required: true,
            message: '请选择申请部门',
            trigger: 'change'
          }
        ],
        date: [
          {
            required: true,
            message: '请输入申请日期',
            trigger: 'blur'
          }
        ],
        old_value: [
          {
            required: true,
            message: '请输入原值',
            trigger: 'blur'
          }
        ],
        depreciation: [
          {
            required: true,
            message: '请输入已提折旧',
            trigger: 'blur'
          }
        ],
        new_value: [
          {
            required: true,
            message: '请输入净值',
            trigger: 'blur'
          }
        ],
        sort: [
          {
            required: true,
            message: '请输入排序',
            trigger: 'blur'
          }
        ]
      }
    }
  },
  watch: {},
  created() {},
  methods: {
    save() {
      const thisData = this.data
      const thisForm = this.$refs.form
      this.addOne(API, thisData, thisForm)
    }
  }
}
</script>
